// ===============================================================================
// scan: sequential scan of a large descriptor collection
// Created in September 2007 as a project for an Advanced Database Systems course
// (c) Reykjavik University, Björn Þór Jónsson, Kristleifur Daðason, Herwig Lejsek
// Contact author: Björn Þór Jónsson, Reykjavík University, bjorn@ru.is
// ===============================================================================

#ifndef FLEXDESCRIPTOR
#define FLEXDESCRIPTOR

#include <iostream>

using namespace std;

// Defines the structure of the .data files
struct FlexDescriptor
{
	int id;
	signed char dim[0];
};

// Since the dimensionality is not encoded in the 
// descriptor, this function calculates it for us
static int getFlexDescByteSize(int nrDims)
{
	return sizeof(int) + (sizeof(signed char) * nrDims);
};

static void printFlexDesc(FlexDescriptor *desc, int nrDims)
{
	int x = desc->dim[0];
	cout << "(" << desc->id << ",[" << x;
	for (int i=1; i<nrDims; i++) {
		x = desc->dim[i];
		cout << "," << x;
	}
	cout << "])" << endl;
};

#endif

